﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.CreditCards
{
    public class CreditCardIdSpecification : Specification<CreditCard>
    {
        #region public properties

        public Guid CreditCardId
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public CreditCardIdSpecification(Guid creditCardId)
        {
            this.CreditCardId = creditCardId;
        }

        #endregion

        #region public methods

        public override Expression<Func<CreditCard, bool>> SatisfiedBy()
        {
            Specification<CreditCard> spec = new TrueSpecification<CreditCard>();
            spec &= new DirectSpecification<CreditCard>(c => c.CreditCardId == this.CreditCardId);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
